package com.fandou.airobot.domain.request;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import com.fandou.airobot.data.repository.DataRepository;

/**
 * Create by yangzj at 2020/6/22
 */
public class RecordingPeriodRequest implements Request.IRecordingPeriodRequest {
    private MutableLiveData<Integer> periodLiveData;
    @Override
    public LiveData<Integer> getRecordingPeriodLiveData() {
        if (periodLiveData == null) {
            periodLiveData = new MutableLiveData<>();
        }
        return periodLiveData;
    }

    @Override
    public void requestRecordingPeriod() {
        DataRepository.getInstance().getRecordingPeriodTime(periodLiveData);
    }

    @Override
    public void saveRecordingPeriod(int time) {
        DataRepository.getInstance().saveRecordingPeriodTime(time);
    }
}
